/* 
* @Author: anchen
* @Date:   2018-12-31 10:08:15
* @Last Modified by:   anchen
* @Last Modified time: 2018-12-31 15:54:06
*/
$(function () {

});

function searchData() {


    var table = layui.table, layer = layui.layer;

    table.init('serviceTable',{
        data: [

            {
                id: 1,
                "BGH": "广东省***通讯大楼6层西部之二房",
                "JJHMC": "广东省***基金会",
                "BGLY": "后台操作",
                "BGQ": "广东省***西平云路163号通"
            },
            {
                id: 2,
                "BGH": "1.扶贫济困、安老助残；\r\n2.资助紧急灾害。\r\n",
                "JJHMC": "广东省三棵柚公益基金会",
                "BGLY": "后台操作",
                "BGQ": "1.扶贫济困、安老助残；\r\n2.资助紧急灾害；\r\n"
            }

        ]
        , toolbar: true
        , title: '基金会变更登记信息'
        , page: true
    });

    //监听行工具事件
    table.on('tool(serviceTable)', function (obj) { //注：tool 是工具条事件名，test 是 table 原始容器的属性 lay-filter="对应的值"
        var data = obj.data //获得当前行数据
            , layEvent = obj.event; //获得 lay-event 对应的值

        if (layEvent === 'detail') {
            loadDetail(data.id)
        }
    });
}

function loadDetail(id) {
    var data = [
           {
            "BGH": "广东省***通讯大楼6层西部之二房",
            "BGSX": "住所",
            "GXSJ": "2017-03-08",
            "JJHMC": "广东省***基金会",
            "BGLY": "后台操作",
            "BGQ": "广东省***西平云路163号通"
        },
        {
            "BGH": "1.扶贫济困、安老助残；\r\n2.资助紧急灾害。\r\n",
            "BGSX": "业务范围",
            "GXSJ": "2017-03-07",
            "JJHMC": "广东省三棵柚公益基金会",
            "BGLY": "后台操作",
            "BGQ": "1.扶贫济困、安老助残；\r\n2.资助紧急灾害；\r\n"
        }


    ];


    var data0 = data[parseInt(id) - 1];

    $('#detailD').html(template('detailDS',{data:data0}))
    layer.open({
        type: 1,
        content: $("#detail"),
        area: ['900px', '550px'],
        title: '基金会变更登记信息',
        maxmin: true,
        shade: 0,
        cancel: function () {
            $("#detail").hide()
        }
    });


}